package com.wangzeqi.changliaoba.messege;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

/**
 * Created by dllo on 16/3/4.
 */
public class MessegeChangeListener implements TextWatcher {
    private Button button;
    private ImageView imageView;
    private EditText editText;

    public MessegeChangeListener(Button button, ImageView imageView,EditText editText) {
        this.button = button;
        this.imageView = imageView;
        this.editText = editText;
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        imageView.setVisibility(View.INVISIBLE);
        button.setVisibility(View.VISIBLE);
        if(editText.getText().toString().length()==0){
            button.setVisibility(View.INVISIBLE);
            imageView.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void afterTextChanged(Editable s) {

    }
}
